import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

import static org.openqa.selenium.By.id;
import static org.openqa.selenium.By.name;

public class Login {

    public static String userName = "sjeyarajah";
    public static String password = "thaneya";
    public static String fakeUserName = "ggghd";

    private final WebDriver driver;
    public static WebElement loginField;

    public Login(WebDriver driver) {
        this.driver = driver;
    }

    public void typeUserName() {
        loginField = driver.findElement(id(PageVariableValues.loginUserNameField));
        loginField.sendKeys(userName);
    }

    public void typePassword() {
        WebElement passwordField = driver.findElement(id(PageVariableValues.loginPasswordField));
        passwordField.sendKeys(password);
    }

    public void clickSignIn() {
        WebElement signInButton = driver.findElement(name(PageVariableValues.loginPageButton));
        signInButton.click();
    }

    public void typeFakeUserName() {
        loginField = driver.findElement(id(PageVariableValues.loginUserNameField));
        loginField.sendKeys(fakeUserName);
    }

}
